//update_question_share_count
exports.update_question_share_count = function (req, res) {

    var bodyParams = req.routeInfo.bodyParams;

    //最终结果
    var resultData = {};

    var fc_id = bodyParams.fc_id;

    //任务流创建
    async.waterfall([
            //查询分享次数
            function (cb) {
                if (fc_id) {
                    R.SEND_HTTP(
                        req,
                        {
                            url: CORE_APIConfig.coreAPI.searchForumContent + "/fc_id/" + fc_id,
                            method: 'POST',
                            data: {
                                fields: ['fc_id', 'fc_share_count'].join(",")
                            }
                        },
                        function (err, data) {

                            //判断是否有错误信息
                            if (err) {
                                return cb(err, data);
                            }

                            resultData.questionData = data.data;

                            cb();
                        }
                    );
                } else {
                    cb()
                }

            },
            function (cb) {
                if (resultData.questionData.length>0) {
                    var shareCount = resultData.questionData[0].fc_share_count;
                    R.SEND_HTTP(
                        req,
                        {
                            url: CORE_APIConfig.coreAPI.updateForumContent,
                            method: 'POST',
                            data: {
                                fc_id:fc_id,
                                fc_share_count:parseInt(shareCount)+1
                            }
                        },
                        function (err, data) {

                            //判断是否有错误信息
                            if (err) {
                                return cb(err, data);
                            }

                            resultData.updateData = data.data;

                            cb();
                        }
                    );
                } else {
                    cb()
                }

            }

        ], function (err, result) {

            //返回最终拼接结果
            RES.response(res, true, resultData);

        }
    );


}